<?php

/**
* Ticket Model
*/
class Ticket extends AppModel
{
	var $name = 'Ticket';
	
	var $validate = array(
	      'name' => VALID_NOT_EMPTY
	   );
	
	var $belongsTo = array('User' =>
                           array('className'  => 'User',
                                 'conditions' => '',
                                 'order'      => '',
                                 'foreignKey' => 'user_id'
                           ),
						'Milestone' => array('className'  => 'Milestone',
			                                 'conditions' => '',
			                                 'order'      => '',
			                                 'foreignKey' => 'milestone_id'
                           ),
						'Batch' => array('className'  => 'Batch',
		                         		'conditions' => '',
		                         		'order'      => '',
		                         		'foreignKey' => 'batch_id'
                           )
                     );
	var $hasAndBelongsToMany = array('UserTicket' =>
	                               array('className'    => 'User',
	                                     'joinTable'    => 'ticket_users',
	                                     'foreignKey'   => 'ticket_id',
	                                     'associationForeignKey'=> 'user_id',
	                                     'conditions'   => '',
	                                     'order'        => '',
	                                     'limit'        => '',
	                                     'unique'       => true,
	                                     'finderQuery'  => '',
	                                     'deleteQuery'  => '',
	                               )
	                               );

	var $hasMany = array('Reply' =>
	                         array('className'     => 'Reply',
	                               'conditions'    => '',
	                               'order'         => '',
	                               'limit'         => '',
	                               'foreignKey'    => 'ticket_id',
	                               'dependent'     => true,
	                               'exclusive'     => false,
	                               'finderQuery'   => ''
	                         ),
						'Document' =>
	                        array('className'     => 'Document',
	                               'conditions'    => '',
	                               'order'         => '',
	                               'limit'         => '5',
	                               'foreignKey'    => 'ticket_id',
	                               'dependent'     => true,
	                               'exclusive'     => false,
	                               'finderQuery'   => ''
                         ),
						 'Funding' =>
                         array('className'     => 'Funding',
                               'conditions'    => '',
                               'order'         => '',
                               'limit'         => '',
                               'foreignKey'    => 'ticket_id',
                               'dependent'     => true,
                               'exclusive'     => false,
                               'finderQuery'   => ''
                         )
						 );
}

?>